﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class AdminControl_ProsDetails : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        DataTable dataTable = new DataTable();
        dataTable.Columns.Add("imageurl");
        dataTable.Columns.Add("proname");
        dataTable.Columns.Add("usefor");
        dataTable.Columns.Add("gender");
        dataTable.Columns.Add("countview");
        dataTable.Columns.Add("descript");
        dataTable.Columns.Add("edit");
        dataTable.Columns.Add("delete");
        dataTable.Columns.Add("details");

        ShoppingDataContext spdt = new ShoppingDataContext();
        var pros = from p in spdt.PRODUCTs
                   select p;

        foreach (var pro in pros)
        {
            DataRow row = dataTable.NewRow();
            row["imageurl"] = pro.image;
            row["proname"] = pro.ProName;
            row["usefor"] = pro.usefor;
            row["gender"] = pro.gender;
            row["countview"] = pro.countview;
            row["descript"] = pro.Descript;
            row["edit"] = "../AdminTool/EditProDetails.aspx?proid=" + pro.ProductID;
            row["delete"] = "DeleteProduct.aspx?proid=" + pro.ProductID;
            row["details"] = "../AdminTool/ProDesDetails.aspx?proid=" + pro.ProductID;
            dataTable.Rows.Add(row);
        }

        productsdetails.DataSource = dataTable;
        productsdetails.DataBind();
    }
}
